package cn.bjit.manager.impl;

import cn.bjit.manager.AccountManager;
import cn.bjit.mapper.AccountMapper;
import cn.bjit.model.AccountDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Slf4j
public class AccountManagerImpl implements AccountManager {
    @Resource
    private AccountMapper accountMapper;
    @Override
    public int insert(AccountDO accountDO) {
        return accountMapper.insert(accountDO);
    }

    /**
     * 根据手机号码查询数据库
     * @param phone
     * @return
     */
    @Override
    public List<AccountDO> findByPhone(String phone) {
        List<AccountDO> accountDOList= accountMapper.selectList(new QueryWrapper<AccountDO>().eq("phone",phone));
        return accountDOList;
    }
}
